﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace FileManager
{
    public partial class RunOOBPopup : ChildWindow
    {
        public RunOOBPopup()
        {
            InitializeComponent();
            DisplayOOBStatus();
        }

        #region DisplayOOBStatus
        private void DisplayOOBStatus()
        {
            switch (Application.Current.InstallState)
            {
                case InstallState.Installed:
                case InstallState.Installing:
                    lblStatus.Text = "To access your local computer, you must close this application and run it from the icon on your local computer.";
                    btnInstall.Visibility = Visibility.Collapsed;
                    break;
                case InstallState.InstallFailed:
                case InstallState.NotInstalled:
                    lblStatus.Text = "To access your local computer, you must Click the Install button below to install it. Then, close this application and run it from the icon on your local computer.";
                    btnInstall.Visibility = Visibility.Visible;
                    break;
                default:
                    break;
            }
        } 
        #endregion

        #region CancelButton_Click
        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
        } 
        #endregion

        #region btnInstall_Click
        private void btnInstall_Click(object sender, RoutedEventArgs e)
        {
            Application.Current.Install();
        } 
        #endregion
    }
}

